package com.bestdo.t;

import java.io.BufferedReader;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import java.util.function.BiConsumer;

import org.apache.commons.lang.math.NumberUtils;

public class SumSort {

	static Map<String, Integer> map = new LinkedHashMap<>();
	static int i = 0;
	public static void main(String[] args) throws IOException {
		getMap("/Users/zhaokuner/Downloads/clp");
		getMap("/Users/zhaokuner/Downloads/clpb");
//		System.out.println(map);
		map.forEach(new BiConsumer<String, Integer>() {

			@Override
			public void accept(String t, Integer u) {
				System.out.println(t+" "+u);
			}
		});
		System.out.println(map.size());
		System.out.println(i);
	}

	static void getMap(String path) throws IOException{
		Path p = Paths.get(path);
		BufferedReader br = Files.newBufferedReader(p);
		String line = br.readLine();
		while (!Objects.isNull(line)) {
			i++;
			Integer integer = map.get(line);
			if(null == integer){
				map.put(line, 1);
			}else{
				map.put(line, integer+1);
			}
			line = br.readLine();
		}
	}
	
}
